#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    int yan = 0;
    for (int i = n; i > 0; i--) {
        yan++;
        if (yan == k) {
            yan = 0;
            n++;
            i++;
        }
    }
    printf("%d", n);
    return 0;
}